package com.atguigu.gulimallflow.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.gulimallflow.entity.ActRuEventSubscrEntity;
import com.atguigu.gulimallflow.service.ActRuEventSubscrService;
import utils.PageUtils;
import utils.R;



/**
 *
 *
 * @author humingyang
 * @email humingyang@163.com
 * @date 2022-04-10 15:02:52
 */
@RestController
@RequestMapping("gulimallflow/actrueventsubscr")
public class ActRuEventSubscrController {
    @Autowired
    private ActRuEventSubscrService actRuEventSubscrService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("gulimallflow:actrueventsubscr:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = actRuEventSubscrService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("gulimallflow:actrueventsubscr:info")
    public R info(@PathVariable("id") String id){
		ActRuEventSubscrEntity actRuEventSubscr = actRuEventSubscrService.getById(id);

        return R.ok().put("actRuEventSubscr", actRuEventSubscr);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("gulimallflow:actrueventsubscr:save")
    public R save(@RequestBody ActRuEventSubscrEntity actRuEventSubscr){
		actRuEventSubscrService.save(actRuEventSubscr);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("gulimallflow:actrueventsubscr:update")
    public R update(@RequestBody ActRuEventSubscrEntity actRuEventSubscr){
		actRuEventSubscrService.updateById(actRuEventSubscr);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
   // @RequiresPermissions("gulimallflow:actrueventsubscr:delete")
    public R delete(@RequestBody String[] ids){
		actRuEventSubscrService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
